package com.dqhl.community.base;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.BaseAdapter;
import android.widget.Toast;

/**
 * Created by LIENLIN on 2016/8/31.
 */
public abstract class BaseMyAdapter extends BaseAdapter {

    public Context context;
    public LayoutInflater inflater;
    private Toast mToast;

    public BaseMyAdapter(Context context) {
        this.context=context;
        inflater= (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    /**
     * 直接跳转到另一个activity
     * @param classObj 要跳转的activity
     */
    public void overlay(Class<?> classObj) {
        Intent intent = new Intent(context, classObj);
        context.startActivity(intent);
    }
    public void overlay(Class<?> classObj, Bundle bundle) {
        Intent intent = new Intent(context, classObj);
        intent.putExtras(bundle);
        context.startActivity(intent);
    }

    /**
     * Toast
     * @param msg 文字信息
     */
    public void toast(String msg) {
        mToast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        mToast.show();
    }
}
